package com.frank.globalException.web;

import com.frank.globalException.domain.EnumError;
import com.frank.globalException.exception.MyException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小石潭记
 * @date 2020/10/22 9:57
 * @Description: ${todo}
 */
@RestController
@RequestMapping("/exception")
public class ExceptionController {

    @GetMapping("/index")
    public Object test(String name){
        if (name.equals("cxb")) {
            throw new MyException(EnumError.OTHER_ERROR);
        }
        return name;
    }
}
